/** @format */

/**
 *
 *  默认接口最外层会tryCatch  某些特殊接口需要自定义tryCatch 可以使用该装饰器
 *
 * @export
 * @param {*} target
 * @param {string} name
 * @param {PropertyDescriptor} descriptor
 */
export default function noCatch(target: any, name: string, descriptor: PropertyDescriptor) {
  const method = descriptor.value
  descriptor.value = async function (...args: any[]) {
    const [context, otherArgs = {}] = args
    return method.apply(this, [context, { ...otherArgs, noCatch: true }])
  }
}
